Skip to content

audition/cool_wv4.c: bounds-check cue/plst/ltxt special data sizes#238

Merged
dbry merged 1 commit into
dbry:masterfrom
aizu-m:audition-special-data-overflow
Jun 15, 2026
Merged

audition/cool_wv4.c: bounds-check cue/plst/ltxt special data sizes#238
dbry merged 1 commit into
dbry:masterfrom
aizu-m:audition-special-data-overflow

Conversation

@aizu-m

@aizu-m aizu-m commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Reconstructing the RIFF chunks from a file's wrapper, a crafted "cue " chunk:

cue payload = 12 bytes, count field = 0x20000000
-> reads 0x20000000 * 24 bytes from a 12-byte buffer
-> GlobalAlloc(0x20000000 * 8) wraps to 0 on Win32, the loop writes 4 GiB

FilterGetNextSpecialData takes the record count straight out of the chunk payload, which comes from WavpackGetWrapperData and so is attacker controlled, then uses it as both the GlobalAlloc size and the loop bound with no check against dwSize. "plst" has the same shape. "ltxt" copies a fixed 12 bytes into a GlobalAlloc(dwSize - 4) buffer, so a dwSize below 20 overruns the destination (and below 4 underflows the size).

Found while reading the wrapper-replay path. The encode side derives the counts from dwSize, so it is safe; the decode side trusts the stored count, so it is not.

Validate each count and size against dwSize before allocating and copying.

@dbry dbry self-assigned this Jun 13, 2026
@dbry

dbry commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Created an appropriately corrupt WavPack file and verified that (1) it crashes the Cool Edit plugin without this fix, and (2) the fix causes the cue list to be silently ignored (which, BTW, is exactly what Cool Edit does when presented with the same corruption in a native WAV file).

Thanks!

@dbry dbry merged commit c13f14c into dbry:master Jun 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants